/**
 *
 */
package org.jprobe.junit;


/**
 * defines a default object that can be used to register time
 * elapsed to execute certain task
 * @author Hussain Al-Mutawa
 * @version 2.0
 * @since 2.0
 */
public abstract class AbstractTimeRegister implements TimeMeasurable {

	/** the time elapsed for a transaction **/
	private transient long time;

	/** output stream **/
	public abstract void out(String message);
	/** error stream **/
	public abstract void err(String message);

	@Override
	public void startTimeCount() {
		//System.setSecurityManager(new NoExitSecurityManager());
		time=System.currentTimeMillis();
		this.processStarted();
	}
	@Override
	public void stopTimeCount() {
		//System.setSecurityManager(null);
		time=System.currentTimeMillis()-time;
		this.processCompleted();
	}
	@Override
	public long getElapsedTime() {
		return time;
	}
}
